ke.create({
	data:{
		loadList:true,
		list:[],
		total:0,
		size:20,

		search:{
			key:'',
			status:-1,
			date:''
		},

		dialog:{
			status:false,
			form:{},
			rules:{
				value:[
					{ required: true, message: '请输入充值数值', trigger: 'blur' }
				]
			},
			title:null,
			label:null,
			post:null
		}
	},
	methods:{
		tabSize:function(s){
			this.size = s
			this.loadLists(1)
		},
		loadLists:function(p){
			this.loadList = true
			http.get({
				params:{
					size:this.size,
					page:p,
					key:this.search.key,
					status:this.search.status,
					date:this.search.date,
				},
				success:function(res){
					vm.loadList = false
					if(res.code ===0 ){
						vm.$message.error(res.msg)
					}else{
						vm.list = res.data.list
						vm.total = res.data.total
						vm.scrollTop()
					}
				}
			})
		},
		onUserAction:function(obj){
			switch (obj.type) {
				case 'money':
					this.dialog.status = true
					this.dialog.title = '充值金额'
					this.dialog.label = '金额'
					this.dialog.form.id = obj.item.id
					this.dialog.post = this.map.money

					break;
				case 'integral':
					this.dialog.status = true
					this.dialog.title = '充值积分'
					this.dialog.label = '数值'
					this.dialog.form.id = obj.item.id
					this.dialog.post = this.map.integral

					break;
				case 'edit':
					this.maps('edit', {id: obj.item.id})
					break;
				case 'delete':
					this.onDelete(obj.item.id)
					break;
				default:
					break;
			}
		},
		onDialogResetFields:function(){
			this.$refs['dialogForm'].resetFields()
		},
		onDialogSubmit:function(type){
			if(type){
				this.$refs['dialogForm'].validate(function(valid){
					if (valid) {
						http.post({
							url: vm.dialog.post,
							data: vm.dialog.form,
							success:function(res){
								if(res.code===0){
									vm.$message.error(res.msg)
								}else{
									vm.$message.success('充值成功')
									vm.dialog.status = false
								}
							}
						})
					}
				})
			}else{
				this.dialog.status = false
			}

		},
		onDelete:function(id){
			this.$confirm('此操作将彻底删除该记录，是否继续？',{
				callback:function(type){
					if(type=='confirm'){
						http.post({
							url:vm.map.delete,
							data:{id:id},
							success:function(res){
								if(res.code===0){
									vm.$message.error(res.msg)
								}else{
									vm.$message.success('删除成功')
									setTimeout(function(){
										vm.reload()
									},800)
								}
							}
						})
					}
				}
			})
		},
		onSearch:function(){
			this.loadLists(1)
		}
	},
	created:function(){
		this.loadLists(1)
	}
})